var gulp = require("gulp");
var connect = require("gulp-connect")
var sass = require('gulp-sass-china');
gulp.task("index",function(){
	return gulp.src("index.html")
	.pipe(gulp.dest("dist"))
	.pipe(connect.reload())
})
gulp.task("watch",function(){
	gulp.watch("index.html",["index"]);
	gulp.watch("sass/*.scss",["sass"])
})
gulp.task('server',function(){
    connect.server({
        root:'dist',  //以谁为服务器根目录
        port:8888,  // 端口号 
        livereload:true
    });
})

gulp.task('sass', function () {
return gulp.src('sass/*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(gulp.dest('dist/css'));
});

gulp.task("default",["server","watch"])
